package com.bupt.godxian.charging.service;
import com.bupt.godxian.charging.entity.WaitQueue;
import com.bupt.godxian.charging.mapper.WaitQueueMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WaitQueueService {
    private final WaitQueueMapper waitQueueMapper;

    @Autowired
    public WaitQueueService(WaitQueueMapper waitQueueMapper) {
        this.waitQueueMapper = waitQueueMapper;
    }

    public WaitQueue createWaitQueue(WaitQueue waitQueue) {
        // 添加创建等候队列的逻辑
        // 返回创建的等候队列对象
        waitQueueMapper.insert(waitQueue);
        return waitQueue;
    }

    public WaitQueue getWaitQueueById(Long id) {
        // 添加根据 ID 查询等候队列的逻辑
        // 返回查询到的等候队列对象
        return waitQueueMapper.selectByPrimaryKey(id);
    }

    // 添加其他需要的方法，如更新等候队列、删除等候队列等
    public int getWaitQueueCount(int state) {
        return waitQueueMapper.getWaitQueueCount(state);
    }

    public void addWaitQueue(String chargeMode, String chargeId) {
//        waitQueueMapper.addWaitQueue(chargeMode, chargeId);
          waitQueueMapper.insert(chargeMode, chargeId,1);
    }

}
